<?php
//rss view of the new / updated products rss feeds
Configure::write('debug', 0);
$title = '';
if ($requested == 'changed') {
	$title = 'Updated Products';
	$description = 'Products changed between ' . $dates;
} else if ($requested = 'new') {
	$title = 'New Products';
	$description = 'Products added between ' . $dates;
}

$title = Configure::read('abbreviated_site_name') . ': ' . $title;
$open = $this->requestAction('/deliveries/isOpen');

$this->set('channel', array(
	'title' => $title,
	'link' => $html->url('/products/view/' . $requested, true),
	'description' => $description,
	'language' => 'en-us')
);

foreach($products as $product) {
	$link = ($open) ? $html->url('/orderables/order/' . $product['Orderable']['id'], true) : $html->url('/products/info/' . $product['Product']['product_id'], true);
	echo $rss->item(array(), array(
		'title' => $product['Product']['product_name'],
		'link' => $link,
		'guid' => array('url' => $link, 'isPermalink' => false),
		'description' => $product['Product']['detailed_notes'],
		'pubDate' => $product['Product']['modified']
		)
	);
}


?>